<?php

Loader::using("underscore::core::util::UnderscoreCompositionInitializer");

/**
 * An object that can have it's dependencies dynamically
 * resolved, usually it decides when to do so.
 *
 * @author JeyDotC
 */
abstract class AbstractCompositionObject {

    /**
     *
     * @var MEF_CompositionInitializer
     */
    private $mef;

    /**
     * Executes the dependencies resolving.
     */
    protected function satisfyImports() {
        $this->mef = new UnderscoreCompositionInitializer($this->getContainer());
        $this->mef->satisfyImports($this);
    }

    /**
     * Implementor must return a {@link MEF_Container_ContainerInterface} implementation to allow the
     * dependencies resolving.
     * 
     * @return MEF_Container_ContainerInterface
     */
    protected abstract function getContainer();

    /**
     *
     * @return MEF_CompositionInitializer
     */
    protected function getCompositionInitializer() {
        return $this->mef;
    }

}

?>
